#include "cutil.h"
#include "wsecondspaceapp.h"

/**
    @file main.cpp
    @author Claus Wimmer
    @date 2012-10-05

    Project: secondspace
    Licence: LGPL (Lesser GPL)
*/

/**
    @brief Main entry.
    @author Claus Wimmer
    @date 2012-10-05
    @param argc Number of command line params.
    @param argv Command line params as strings.

    When one param is present then 2 == argc. Program accepts only one param
    Either "-help" or <config-file-path>.

  */
int main(int argc, char *argv[]) {

    QApplication a(argc, argv);

    // Eval command line args.
    if(1 < argc){
        // Case "-help".
        if(QString("-help") == QString(argv[1])){
            CUtil::showMessage("Simulation in finite space.");
            CUtil::showMessage("===========================");
            CUtil::showMessage("Needs OPENCL graphic card and its driver.");
            CUtil::showMessage("");
            CUtil::showMessage("Usage:");
            CUtil::showMessage("secondspace [<root-based-config-file-dir-path>]");
            CUtil::showMessage("");
        } else {
            // Case <config-file-path>.
            CUtil::configdir = QString(QObject::trUtf8(argv[1]));
        }
    }

    // Start the prog.
    CUtil::provideConfigDir();
    CUtil::showMessage(QString("Config file can be found in %1.").arg(CUtil::configdir));
    WSecondSpaceApp w;
    w.show();
    w.activateWindow();

    // Return console error status.
    return a.exec();

}
